package src.main.StructuralPatterns.Composite;

public class Client {
    public static void main(String[] args) {
        // 创建目录
        Directory root = new Directory("root");

        // 创建子目录
        Directory photos = new Directory("photos");
        Directory docs = new Directory("docs");

        // 创建文件
        File photo = new File("photo");
        File photo2 = new File("photo2");
        File doc = new File("doc");
        File doc2 = new File("doc2");

        // 构建树结构
        root.add(photos);
        root.add(docs);

        photos.add(photo);
        photos.add(doc);
        photos.add(photo2);
        photos.add(doc2);

        // 展示
        root.display(0);
    }
}
